<template>
  <div class="bgff p20 pcub pcub-pc" style="min-height:100%;box-sizing:border-box;">
    <el-form
      :model="ruleForm"
      :rules="rules"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
      style="width:400px;"
    >
      <el-form-item label="姓名" prop="name">
        <el-input v-model="ruleForm.name" placeholder="姓名"></el-input>
      </el-form-item>
      <el-form-item label="所属辖区" prop="region">
        <el-select v-model="ruleForm.region" placeholder="所属辖区" disabled>
          <el-option label="雨城区" value="shanghai"></el-option>
          <el-option label="天全县" value="beijing"></el-option>
          <el-option label="庐山区" value="beijinglll"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="项目" prop="region">
        <el-select v-model="ruleForm.region" placeholder="所属辖区" disabled>
          <el-option label="工程A" value="shanghai"></el-option>
          <el-option label="工程B" value="beijing"></el-option>
          <el-option label="工程C" value="beijinglll"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="账户状态" prop="delivery">
        <span style="color:green;">正常</span>
      </el-form-item>
      <el-form-item label="登录密码" prop="delivery">
        <el-button size="mini" type="primary" @click="updata">修改</el-button>
      </el-form-item>
      <el-form-item label="联系电话" prop="delivery">
        <span style="color:green;">130xxxx4511</span>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        name: "测试账户",
        region: "shanghai",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      },
      rules: {
        name: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        ],
        region: [
          { required: true, message: "请选择活动区域", trigger: "change" }
        ],
        date1: [
          {
            type: "date",
            required: true,
            message: "请选择日期",
            trigger: "change"
          }
        ],
        date2: [
          {
            type: "date",
            required: true,
            message: "请选择时间",
            trigger: "change"
          }
        ],
        type: [
          {
            type: "array",
            required: true,
            message: "请至少选择一个活动性质",
            trigger: "change"
          }
        ],
        resource: [
          { required: true, message: "请选择活动资源", trigger: "change" }
        ],
        desc: [{ required: true, message: "请填写活动形式", trigger: "blur" }]
      }
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },

    updata(){
      this.$prompt('请输入密码', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(({ value }) => {
          this.$message({
            type: 'success',
            message: '你的密码是: ' + value
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '取消输入'
          });       
        });
    }
  }
};
</script>

<style scoped lang="less">
</style>
